package com.lordjoe.collectiveintelligence.data;

/**
 * com.lordjoe.collectiveintelligence.data.SquaredDistanceMetric
 *
 * @author Steve Lewis
 * @date May 12, 2009
 */
public class SquaredDistanceMetric implements IDistanceMetric<Double>
{
    public static SquaredDistanceMetric[] EMPTY_ARRAY = {};
    public static Class THIS_CLASS = SquaredDistanceMetric.class;

    private final double m_Scale;

    public SquaredDistanceMetric(double pScale)
    {
        m_Scale = pScale;
    }

    public double getScale()
    {
        return m_Scale;
    }

    public double getDistance(Double t1, Double t2)
    {
        double del = t1 - t2;
        return getScale() * del * del;
    }
}
